<?php
class new_status extends common
{
    function index()
    {

        $_GET['id'] = isset($_GET['id']) ? intval($_GET['id']) : 0;
        $_GET['type'] = isset($_GET['type']) ? intval($_GET['type']) : 1;

        $conn_mysql = _mysqllogon('Mysql_102');

        $sql = "select status,type from spread_news where id=:id";
        $stmt = _mysqlparse($conn_mysql, $sql);
        _mysqlbindbyname($stmt, ':id', $_GET['id']);
        $mysqlerror = _mysqlexecute($stmt);
        $new_info = mysql_fetch_assoc($stmt);
        if ($new_info['type'] != 1 && $new_info['status'] && $new_info['status'] != $_GET['type']) {
            $sql_u = "update spread_news set status =:status where id=:id";
            $stmt_u = _mysqlparse($conn_mysql, $sql_u);
            _mysqlbindbyname($stmt_u, ':status', $_GET['type']);
            _mysqlbindbyname($stmt_u, ':id', $_GET['id']);
            _mysqlexecute($stmt_u);
        }

        header("Location: /spread_project.php?act=new_list");
    }
}

?>